<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<link href="<c:url value='/css/easyui.css'/>" rel="stylesheet">
<link href="<c:url value='/css/icon.css'/>" rel="stylesheet">
<script src="<c:url value='/js/jquery.min.js'/>"></script>
<script type="text/javascript"	src="<c:url value='/js/jquery.easyui.min.js'/>"></script>
<div class="page-header" style="width: 85%">
	<h3 style="margin-top: auto">接口详细信息</h3>
</div>
<c:set var="muri" value="${fn:replace(item.uri,':', '/')}" />
<div class="row-fluid" >
	<div>
		<table class="table table-hover">
			<thead>
				<tr>
					<th style="width: 15%">属性</th>
					<th style="width: 85%">详细信息<button class="btn btn-small" style="float: right;margin-right:30px" onclick="history.back()"><i class="icon-arrow-left"></i>&nbsp;取消</button></th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>名称</td>
					<td><c:out value="${item.name}" /></td>
				</tr>
				<tr>
					<td>类别</td>
					<td><c:out value="${item.itype}" /></td>
				</tr>
				<tr>
					<td>创建者</td>
					<td><c:out value="${item.owner.username}" /></td>
				</tr>
				<tr>
					<td>描述信息</td>
					<td><c:out value="${item.description}" /></td>
				</tr>
				<c:choose>
					<c:when test="${!empty item.interfaceMethods}">
						<tr>
							<td>函数列表</td>
							<td><c:forEach items="${item.interfaceMethods}" var="list"
									varStatus="s">
									<c:set var="newline" value="<%= \"\n\" %>" />
									<c:set var="comment_left" value="/*" />
									<c:set var="comment_right" value="*/" />
									<c:set var="function" value="${comment_left}${list.description}${comment_right}${newline}${list.methodSigniture}" />
									<textarea class="input-xxlarge" readonly="true"><c:out value="${function}" /></textarea>
									<%-- <input type="text" class="input-xxlarge" readonly="true"
										value="${function}" /> --%>
									<div class="btn-group" style="margin-bottom: 5px">
										<button style="margin-left: 20px" type="button" class="btn"
											onclick="window.location.href='<%=request.getContextPath()%>/function/${list.id}/update';">
											<i class="icon-edit"></i>&nbsp;更新
										</button>
										<button type="button" class="btn"
											onclick="window.location.href='<%=request.getContextPath()%>/function/${list.id}/delete';">
											<i class="icon-remove"></i>&nbsp;删除
										</button>
									</div>
									<br />
								</c:forEach></td>
						</tr>
					</c:when>
				</c:choose>
				<tr>
					<td>代码</td>
					<td><pre class="pre-scrollable"><c:out value="${code}" /></pre></td>
				</tr>
				<tr>
					<td>操作</td>
					<td><div class="btn-group">
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/${muri}/update';">
								<i class="icon-edit"></i>&nbsp;更新
							</button>
							<button type="button" class="btn"
								onclick="javascript:$('#myModal').dialog('open')">
								<i class="icon-trash"></i>&nbsp;删除
							</button>
							<button class="btn"
								onclick="window.location.href='<%=request.getContextPath()%>/${muri}/download';">
								<i class="icon-download"></i>&nbsp;下载
							</button>
						</div> <!-- Modal delete interface--></td>
				</tr>
			</tbody>
			<tfoot>
			</tfoot>
		</table>
	</div>
</div>
<div id="myModal" class="easyui-dialog" title="删除接口"
	style="width: 400px; height: auto; padding: 10px" closed="true"
	data-options="iconCls: 'icon-remove-dialog'" buttons="#dlg-buttons">
	<div>
		<p>确定删除该接口吗？</p>
	</div>
</div>
<div id="dlg-buttons" style="float: right;">
	<a
		href="<%=request.getContextPath()%>/${muri}/delete"
		class="easyui-linkbutton" iconCls="icon-ok-dialog" onclick="dlgOK()">确定</a>
	<a href="javascript:void(0)" class="easyui-linkbutton"
		iconCls="icon-cancel-dialog" onclick="dlgCancel()">取消</a>
</div>
<script type="text/javascript">
			$(function() {
				$('#myModal').dialog('close');
			});
			
			function dlgOK(){
				$('#myModal').dialog('close');
			}
			
			function dlgCancel(){
				$('#myModal').dialog('close');
			}
</script>